<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<style>
div {
    width: 100px;
    height: 100px;
}
#firstdiv {
    --b: var(--b);
    --a: var(--b, green);
    background-color: var(--a,red);
}
#seconddiv {
    --c: var(--c);
    --d: var(--c, green);
    background-color: var(--d,red);
}
</style>

<div id=firstdiv></div>
<div id=seconddiv></div>

<script>
test(function() {
  assert_equals(getComputedStyle(firstdiv).backgroundColor, 'rgb(0, 128, 0)');
  assert_equals(getComputedStyle(seconddiv).backgroundColor, 'rgb(0, 128, 0)');
}, 'custom property cycles are marked invalid in the same way, independent of ordering.');
</script>
